const express = require('express');
const router = express.Router();
const data = [];
for(let i = 1; i < 51; i++)
    data.push({
        id: `${i}`,
        code: `code${i}`,
        name: `name${i}`
    });

router.get('/', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: data,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});

router.get('/simple', (req, res) => {
    res.json({
        message: 'ok',
        payload: {
            content: data.slice(0, 10),
        }
    });
});

router.get('/forManucturerProductCategory', (req, res) => {
    const listData = [];
    const {pageIndex, pageSize} = req.query;
    for(let i = 1; i < 6; i++)
        listData.push({
            id: `${i}`,
            code: `201900${i}`,
            name: `JXSMC00${i}`,
            remark: '备注',
        });
    res.json({
        message: '',
        payload: {
            content: listData,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 5,
        }
    });
});

router.get('/forExceptionInfoTransfer', (req, res) => {
    const content = [];
    for(let i = 0; i < 40; i++) content.push({
        id: `${i + 1}`,
        code: `code${i}`,
        name: `name${i}`,
        remark: 'remark',
    });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 40,
        }
    });
});


module.exports = router;
